﻿using System;
using System.Collections;
using System.Collections.Generic;
using BLL;
using BLL.RF.Repair;
using Model;
using Model.RF.Repair;

public partial class ProductRepair_ManageRepair_ProductTypeIDModify : System.Web.UI.Page
{
    ProductTypeIDChange ptc;
    PackageProduct pp;
    ProductType p;

    public ProductRepair_ManageRepair_ProductTypeIDModify()
    {
        ptc = new ProductTypeIDChange();
        pp = new PackageProduct();
        p = new ProductType();
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        string productSN = this.TextBox6.Text.Trim();
        string oldProductTypeID = this.TextBox1.Text.Trim();
        string newProductTypeID = this.TextBox7.Text.Trim();

        productSN = CommHelper.GetProductSN(productSN);
        ProductTypeIDChangeInfo ptci = new ProductTypeIDChangeInfo()
        {
            ProductSN = productSN,
            OldProductTypeID = oldProductTypeID,
            NewProductTypeID = newProductTypeID,
            RecordTime = DateTime.Now,
            UserID = User.Identity.Name
        };
        string result = ptc.InsertRecord(ptci);
        ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script>alert('" + result + "');</script>");
    }

    protected void Button3_Click(object sender, EventArgs e)
    {
        string productSN = this.TextBox3.Text.Trim();
        productSN = CommHelper.GetProductSN(productSN);
        PackageProductInfo ppi = pp.GetPackageProductbyProductSN(productSN);
        IList<PackageProductInfo> ppis = new List<PackageProductInfo>();
        ppis.Add(ppi);
        this.GridView1.DataSource = ppis;
        this.GridView1.DataBind();
    }
}